package com.rankeiot.core.util;

import java.util.concurrent.Future;

/**
 * 前端带进度任务
 * @author desire
 */

public abstract class BaseFrontendTask implements Runnable {
    private String id;
    /**
     * 进度
     */
    private int percent;
    private String errorInfo;
    private String currentInfo;
    private Future<?> future;
    private boolean finished=false;

    public boolean cancel(boolean mayInterruptIfRunning){
       return future.cancel(mayInterruptIfRunning);
    }
    protected void setFinished(boolean finished) {
        this.finished = finished;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getPercent() {
        return percent;
    }

    public void setPercent(int percent) {
        this.percent = percent;
    }

    public String getErrorInfo() {
        return errorInfo;
    }

    public void setErrorInfo(String errorInfo) {
        this.errorInfo = errorInfo;
    }

    public String getCurrentInfo() {
        return currentInfo;
    }

    public void setCurrentInfo(String currentInfo) {
        this.currentInfo = currentInfo;
    }

    public Future<?> getFuture() {
        return future;
    }

    protected void setFuture(Future<?> future) {
        this.future = future;
    }

    public boolean isFinished() {
        return finished;
    }
}
